home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
lang
/
rcs567pc
/
diff16
/
hrealloc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-18
|
598b
|
33 lines
#include "diff.h"
/* #include <sys/types.h>
#include <malloc.h> */
/* by Thorsten Ohl */
void huge *hrealloc(void huge *ptr, long new_size, long old_size)
{
void huge *value = halloc(new_size, (size_t) 1);
if ( !value )
fatal("virtual memory exhausted");
else
{
char huge *dest = value;
char huge *src = ptr;
while ( old_size > 0L )
{
unsigned int bytes = (unsigned int) min(0x8000L, old_size);
memcpy(dest, src, bytes);
old_size -= (long) bytes;
dest += (long) bytes;
src += (long) bytes;
}
}
hfree (ptr);
return value;
}